import React, { Component } from 'react';
import './App.css';
import Login from './views/Login'
import Register from './views/Register'
import Detail from './views/Detail'
import Collect from './views/Collect';
import NotFound from './components/NotFound';
import Index from './views/Index';
import Search from './views/Search';
import { Route, Redirect, Switch } from 'react-router-dom';



class App extends Component {
  render() {
    return (
      <div className="App">
        <Switch>
          {/* d登录页 */}
          <Route path='/index' component={Index}></Route>
          <Route exact path='/login' component={Login}></Route>
          {/* 注册页 */}
          <Route exact path='/register' component={Register}></Route>
          {/* 详情页 */}
          <Route exact path='/detail/:id' component={Detail}></Route>
          <Route exact path='/collect' component={Collect}></Route>
          <Route exact path='/search' component={Search}></Route>
          {/* 重定向 */}
          <Redirect exact from='/' to='/index'></Redirect>
          {/* 其他路径，错误页 */}
          <Route path='*' component={NotFound}></Route>
        </Switch>

      </div >
    );
  }
}

export default App;
